﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using CommunitySystem.GuaZhiDuanLianService;

namespace CommunitySystem
{
    public partial class GuaZhiTuiHuiWindow : ChildWindow
    {
        private GuaZhiDuanLianServiceClient Client1 =
            new GuaZhiDuanLianServiceClient();

        private string IDS;
        public GuaZhiTuiHuiWindow(string ids)
        {
            InitializeComponent();
            IDS = ids;
            Client1.TuiGuaZhiEmpCompleted += new EventHandler<TuiGuaZhiEmpCompletedEventArgs>(Client1_TuiGuaZhiEmpCompleted);
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if(string.IsNullOrEmpty(riqi.Text))
            {
                SilverlightMessageBoxLibrary.Message.ErrorMessage("请填写退回原因！");
                return;
            }
            Client1.TuiGuaZhiEmpAsync(IDS, riqi.Text);
        }

        void Client1_TuiGuaZhiEmpCompleted(object sender, TuiGuaZhiEmpCompletedEventArgs e)
        {
            this.DialogResult = true;
        }
    }
}
